package com.lei.chinese_herbal_medicine.Service.Impl;

import com.lei.chinese_herbal_medicine.Entity.Model;
import com.lei.chinese_herbal_medicine.Mapper.ModelHerbLinkMapper;
import com.lei.chinese_herbal_medicine.Mapper.ModelMapper;
import com.lei.chinese_herbal_medicine.Service.ModelHerbLinkService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * (ModelHerbLink)表服务实现类
 *
 * @author makejava
 * @since 2024-01-18 10:06:42
 */
@Service("modelHerbLinkService")
public class ModelHerbLinkServiceImpl implements ModelHerbLinkService {
    @Resource
    private ModelHerbLinkMapper modelHerbLinkMapper;
    @Resource
    private ModelMapper modelMapper;
    @Override
    public Map getModelHerbLinkNum() {
        List<Model> modelList=modelMapper.selectByModel(new Model(),null);
        Map map=new HashMap();
        for (Model model : modelList) {
            Integer num=modelHerbLinkMapper.selectByModelId(model.getId()).size();
            map.put(model.getId(),num);
        }
        return map;
    }
}


